//
//  HomeModel.m
//  marrymarry
//
//  Created by lsj on 16/10/10.
//  Copyright © 2016年 cf. All rights reserved.
//

#import "HomeModel.h"

@implementation HomeModel
-(void)loadDataWithDic:(NSDictionary *)dic
{
    if (dic!=nil) {
        self.otherId =[NSString stringWithFormat:@"%d",[dic[@"id"] intValue]];
        self.userName =[NSString stringWithFormat:@"%@",dic[@"userName"]];
        self.ssex =[NSString stringWithFormat:@"%@",dic[@"ssex"]];
        
        NSString * oldStr = [NSString stringWithFormat:@"%@",dic[@"birthday"]];
        oldStr = [oldStr substringToIndex:3];
        NSDate *date = [NSDate date];
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        [formatter setDateStyle:NSDateFormatterMediumStyle];
        [formatter setTimeStyle:NSDateFormatterShortStyle];
        [formatter setDateFormat:@"YYYY-MM-dd"];
        NSString *DateTime = [formatter stringFromDate:date];
        NSString * yearStr = [DateTime substringToIndex:3];
        self.birthday = [NSString stringWithFormat:@"%d",([yearStr intValue] - [oldStr intValue])];
        
        self.homeMarryTime =[NSString stringWithFormat:@"%@",dic[@"homeMarryTime"]];
        self.startSign =[NSString stringWithFormat:@"%@",dic[@"startSign"]];
        self.height =[NSString stringWithFormat:@"%@",dic[@"height"]];
        self.workCity =[NSString stringWithFormat:@"%@",dic[@"workCity"]];
        
        if ([dic[@"strength"] isKindOfClass:[NSNull class]]) {
            self.strength = @"";
        }else{
        self.strength =[NSString stringWithFormat:@"%@",dic[@"strength"]];
        }
        self.incomeYear =[NSString stringWithFormat:@"%@",dic[@"incomeYear"]];
        self.facePhoto =[NSString stringWithFormat:@"%@",dic[@"facePhoto"]];
        
    }
}
@end
